<?php

    /**
     * Config
     *
     * Configuration manager
     * Loads the configuration files
     *
     * @package      Core
     * @subpackage   Config
     *
     * @license      GNU Lesser General Public Licence see LICENCE-LGPL file or http://www.gnu.org/licenses/lgpl.html
     */
    class Core_Config extends Zend_Config
    {

    ////////////////////////////////////////////////////////////////////////////
    //                                 Methods                                //
    ////////////////////////////////////////////////////////////////////////////

		/**
		 * Loads the section $section from the config file $filename for
		 * access facilitated by nested object properties.
		 *
		 * @param		string          $filename : the name of the file in the config directory
		 * @param		string|null     $section
		 * @param		boolean|array	$config
		 * @throws		Core_ArgumentException
		 * @throws		Core_ArgumentNullException
		 *
		 * @see			Zend_Config_Ini
		 */
		public function __construct($filename, $section = null, $config = array('allowModifications' => true))
		{
            if ($filename === null) {
				throw new Core_ArgumentNullException('filename is a null reference');
			}

            if (strlen(trim($filename)) == 0) {
				throw new Core_ArgumentException('filename is a zero-length string');
			}

            $configs = Core_Config_Compiler::get($filename, $section, $config);
            parent::__construct($configs, true);
		}

		/**
		 * Destructor
		 */
		public function __destruct()
		{
			unset($this);
		}
	}
